package website.seamonster.ethegg.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import website.seamonster.ethegg.dataobject.ChickenFarmView;

import java.util.List;

/**
 * Created by 罗海量
 * 2018-07-23 00:49
 */
public interface ChickenFarmViewRepository extends JpaRepository<ChickenFarmView, String> {
    List<ChickenFarmView> findAllByUserId(String userId);

    List<ChickenFarmView> findByUserIdOrderByChickenId(String userId);

    @Query(value = "select * from view_chicken_farm where user_id=?1", nativeQuery = true)
    List findChickensByUserId(String userId);


}
